package priv.pront.code.national.acwing.math;

import java.util.Scanner;

public class A866_试除法判定质数 {

    static int n;
    static int[] arr;
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        n = scanner.nextInt();
        arr = new int[n];
        for(int i = 0 ; i < n; i++) arr[i] = scanner.nextInt();
        for(int i = 0 ;i < n; i++){
            boolean flag = false;
            int cur = arr[i];
            double t = Math.sqrt(cur);
            if(cur < 2){
                System.out.println("No");
                continue;
            }
            for(int j = 2; j <= t; j++){
                if(cur % j == 0){
                    System.out.println("No");
                    flag = true;
                    break;
                }
            }
            if(!flag) System.out.println("Yes");
        }
    }
}
